package com.three.crm.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.three.crm.R;
import com.three.crm.bean.MessageBean;

import java.util.List;

public class MessageAdapter extends BaseQuickAdapter<MessageBean, BaseViewHolder> {

    public MessageAdapter(@Nullable List<MessageBean> data) {
        super(R.layout.item_list_message,data);
    }

    public MessageAdapter() {
        super(R.layout.item_list_message);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, MessageBean item) {
        helper.setText(R.id.tv_title,item.getTitle())
                .setText(R.id.tv_content, item.getContent())
                .setText(R.id.tv_time, item.getCtime())
                .setGone(R.id.tv_status,item.getIs_read() == 0 ? true:false)
                .setBackgroundRes(R.id.ll_container,item.getIs_read() == 1 ? R.drawable.shape_bg_list_goods_gray:R.drawable.shape_bg_list_goods)
                .addOnClickListener(R.id.tv_detail);;
    }
}
